<?php
/**
 * 后台用户验类
 * @author yupoxiong<i@yufuping.com>
 */

namespace app\admin\validate;

use app\admin\model\OtaGroup;

class OtaImeiValidate extends Validate
{
    protected $rule = [
        'name|升级包名'          => 'require|unique:ota_imei',
        'version|版本号'          => 'require',
        'up_pk|升级文件'          => 'require',
    ];

    protected $scene = [
        'add'   => ['name', 'version', 'up_pk'],
        'edit'   => ['name', 'version', 'up_pk'],
        'editGroup' => ['name','ota_account'],
    ];

    //关联分组
    public function OtaGroup()
    {
        return $this->hasMany(OtaGroup::class, 'ota_group', 'id');
    }
}
